<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>

    // let arr = [1, 2, 3, 1, 2, 3, 1, 1, 1, 1, 2, 3, 4]  
    // let ss = {}
    // for(let i = 0;i < arr.length; i++){
    //   let count = 0
    //   for(let j = 0;j < arr.length; j++){
    //     if(arr[i] === arr[j]){
    //       sum++
    //     }
    //     if(sum>1){
    //       let aum = arr[i]
    //       ss[aum]=sum
    //     }
    //   }
    // }
    // for(let key in ss){
    //   document.write(`重复的数字为${key},重复的次数为${ss[key]}`)
    // }

    let arr = [1, 2, 3, 1, 2, 3, 1, 1, 1, 1, 2, 3, 4]  
    let obj = {}
    for(let i = 0;i < arr.length; i++){
      if(obj[arr[i]]){
        obj[arr[i]]++
      }else {
        obj[arr[i]] = 1
      }
    }
    console.log(obj)
    for(let key in obj){
     console.log(`重复的数字为${key},重复的次数为${obj[key]}`)
    }
  </script>
</body>
</html>